arr = [1, 1, 2, 2, 3, 4, 5, 6, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 22]

## 判断不为空 或者if len(arr)
if arr:
    slow = 0
    new_arr = []
    # for索引为遍历下标
    for fast in range(1, len(arr)):
        if arr[fast-1] != arr[fast]:
            new_arr.append(arr[fast])
            slow += 1
    print(slow, new_arr)
else:
    pass



